﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KTX.Data
{
  public partial  class DayNha : System.ComponentModel.IDataErrorInfo
    {
        public string Error
        {
            get
            {
                if (this.EntityState == System.Data.EntityState.Added || this.EntityState == System.Data.EntityState.Modified)
                {
                    StringBuilder sb = new StringBuilder();

                    if (!String.IsNullOrWhiteSpace(this["Ten"]))
                        sb.AppendLine(this["Ten"]);
                    string errors = sb.ToString();
                    return !String.IsNullOrEmpty(errors) ? errors : String.Empty;
                }
                else
                {
                    return String.Empty;
                }
            }
        }

        public string this[string columnName]
        {
            get
            {
                if (this.EntityState == System.Data.EntityState.Added || this.EntityState == System.Data.EntityState.Modified)
                {
                    switch (columnName)
                    {
                        case "Ten":
                            return String.IsNullOrWhiteSpace(this.Ten) ? "Chưa nhập tên nhà!" : String.Empty;
                        default:
                            return String.Empty;
                    }
                }
                else
                {
                    return String.Empty;
                }
            }
        }
    }
}
